//在数组中查找元素值  
// 返回-1表示没找到，返回其他值表示找到的索 
function in_array(v, a) {  
  var i;  
  for (i = 0; i < a.length; i++) {  
	if (v === a[i]) {  
	  return i;  
	}  
  }  
  return -1;  
}

function changehuoyuebox(pingtai,type,qianhou,riqi,cc){
    
    if(type == "week"){
    type = "Zhou";
     }
     
     if(type == "month"){
    type = "Yue";
     }
     
     //alert('123');
     $("#HuoYue"+pingtai+""+qianhou+"Date"+type).attr("per",riqi);
     $("#HuoYue"+pingtai+""+qianhou+"Date"+type).val(cc);
     $.powerFloat.hide();


}


function closetime(pingtai,t1,t2,zhi){
    
              
              
              
              $.ajax({
  url: "/client/closetime?type="+t1+"&zhi="+zhi+"&pingtai="+pingtai,
  type: "GET",
  dataType : "json",
  jsonnp: "callback",
success: function(msg){
    
   
	if(msg['status'] == "1"){
        
        
        $("#HuoYue"+pingtai+"StartDate"+t2).val(msg['sper']);
        $("#HuoYue"+pingtai+"EndDate"+t2).val(msg['eper']);
        
        
         $("#HuoYue"+pingtai+"StartDate"+t2).attr("per",msg['stime']);
        $("#HuoYue"+pingtai+"EndDate"+t2).attr("per",msg['etime']);
        
        eval("getHuoYue"+pingtai+"Data();");
    
    }
  
}
  
  
  
});
              


}


function leftVideo(div1,div2,type,fx,shun,pingtai){

     if(fx == ">"){
     var zhi = $("#"+div1).find('a:last').attr('per');
 }else{
     var zhi = $("#"+div1).find('a:first').attr('per');}
     
     
     $.ajax({
  url: "/client/changebox?type="+type+"&fx="+fx+"&zhi="+zhi+"&shun="+shun+"&pingtai="+pingtai,
  type: "GET",
  dataType : "json",
  jsonnp: "callback",
success: function(msg){
    
   if(msg['table']!=""){
	$("#"+div2).html(msg['table']);
} 
  
}
  
  
  
});
     
     //alert(zhi);

}

function checkHuoYue(p){
    
    
    var startDate = $("#HuoYueVideoStartDateZhou").attr("per");
	var endDate = $("#HuoYueVideoEndDateZhou").attr("per");
                    
                    if(startDate == "" && endDate == ""){
        
        
        $.ajax({
  url: "/client/startactive?type=week&pingtai=Video",
  type: "GET",
  dataType : "json",
  jsonnp: "callback",
success: function(msg){
    
    $("#HuoYueVideoStartDateZhou").val(msg['sdate']+"");
	$("#HuoYueVideoEndDateZhou").val(msg['edate']+"");
    
    $("#HuoYueVideoStartDateZhou").attr("per",msg['sper']);
	$("#HuoYueVideoEndDateZhou").attr("per",msg['eper']);
    
    
    $("#HuoYueVideoZhouStartXiaLaitem").html(msg['stable']);
	$("#HuoYueVideoZhouEndXiaLaitem").html(msg['etable']); 
  
}
  
  
  
});

    
    
    }
    
    
    
    var startDate = $("#HuoYueVideoStartDateYue").attr("per");
	var endDate = $("#HuoYueVideoEndDateYue").attr("per");
                    
                    if(startDate == "" && endDate == ""){
        
        
        $.ajax({
  url: "/client/startactive?type=month&pingtai=Video",
  type: "GET",
  dataType : "json",
  jsonnp: "callback",
success: function(msg){
    
    $("#HuoYueVideoStartDateYue").val(msg['sdate']+"");
	$("#HuoYueVideoEndDateYue").val(msg['edate']+"");
    
    
    $("#HuoYueVideoStartDateYue").attr("per",msg['sper']);
	$("#HuoYueVideoEndDateYue").attr("per",msg['eper']);
    
    $("#HuoYueVideoYueStartXiaLaitem").html(msg['stable']);
	$("#HuoYueVideoYueEndXiaLaitem").html(msg['etable']); 
  
}
  
  
  
});

    
    
    }
    
    
    
    //拍客
    
    var startDate = $("#HuoYuePaikeStartDateZhou").attr("per");
	var endDate = $("#HuoYuePaikeEndDateZhou").attr("per");
                    
                    if(startDate == "" && endDate == ""){
        
        
        $.ajax({
  url: "/client/startactive?type=week&pingtai=Paike",
  type: "GET",
  dataType : "json",
  jsonnp: "callback",
success: function(msg){
    
    $("#HuoYuePaikeStartDateZhou").val(msg['sdate']+"");
	$("#HuoYuePaikeEndDateZhou").val(msg['edate']+"");
    
    $("#HuoYuePaikeStartDateZhou").attr("per",msg['sper']);
	$("#HuoYuePaikeEndDateZhou").attr("per",msg['eper']);
    
    
    $("#HuoYuePaikeZhouStartXiaLaitem").html(msg['stable']);
	$("#HuoYuePaikeZhouEndXiaLaitem").html(msg['etable']); 
  
}
  
  
  
});

    
    
    }
    
    
    
    var startDate = $("#HuoYuePaikeStartDateYue").attr("per");
	var endDate = $("#HuoYuePaikeEndDateYue").attr("per");
                    
                    if(startDate == "" && endDate == ""){
        
        
        $.ajax({
  url: "/client/startactive?type=month&pingtai=Paike",
  type: "GET",
  dataType : "json",
  jsonnp: "callback",
success: function(msg){
    
    $("#HuoYuePaikeStartDateYue").val(msg['sdate']+"");
	$("#HuoYuePaikeEndDateYue").val(msg['edate']+"");
    
    
    $("#HuoYuePaikeStartDateYue").attr("per",msg['sper']);
	$("#HuoYuePaikeEndDateYue").attr("per",msg['eper']);
    
    
    $("#HuoYuePaikeYueStartXiaLaitem").html(msg['stable']);
	$("#HuoYuePaikeYueEndXiaLaitem").html(msg['etable']); 
  
}
  
  
  
});

    
    
    }
    
    


}


//查看对象
function writeObj(obj){
	var description = "";
	for(var i in obj){  
		var property=obj[i];  
		description+=i+" = "+property+"\n"; 
	}  
	alert(description);
}


function parseObj( strData ){
                return (new Function( "return " + strData ))();
    } 

//array 求和
function array_sum(array) {
	var sum = 0;
	for (var x = 0;  x< array.length; x++ )
		sum += array[x];

	return sum;
}


//四舍五入
Number.prototype.toFixed=function(num) 
{ 
   with(Math)this.NO=round(this.valueOf()*pow(10,num))/pow(10,num); 
   return String(/\./g.exec(this.NO)?this.NO:this.NO+"."+String(Math.pow(10,num)).substr(1,num)); 
} 

function roundNumber(number,decimals) {
	var newString;// The new rounded number
	decimals = Number(decimals);
	if (decimals < 1) {
		newString = (Math.round(number)).toString();
	} else {
		var numString = number.toString();
		if (numString.lastIndexOf(".") == -1) {// If there is no decimal point
			numString += ".";// give it one at the end
		}
		var cutoff = numString.lastIndexOf(".") + decimals;// The point at which to truncate the number
		var d1 = Number(numString.substring(cutoff,cutoff+1));// The value of the last decimal place that we'll end up with
		var d2 = Number(numString.substring(cutoff+1,cutoff+2));// The next decimal, after the last one we want
		if (d2 >= 5) {// Do we need to round up at all? If not, the string will just be truncated
			if (d1 == 9 && cutoff > 0) {// If the last digit is 9, find a new cutoff point
				while (cutoff > 0 && (d1 == 9 || isNaN(d1))) {
					if (d1 != ".") {
						cutoff -= 1;
						d1 = Number(numString.substring(cutoff,cutoff+1));
					} else {
						cutoff -= 1;
					}
				}
			}
			d1 += 1;
		} 
		if (d1 == 10) {
			numString = numString.substring(0, numString.lastIndexOf("."));
			var roundedNum = Number(numString) + 1;
			newString = roundedNum.toString() + '.';
		} else {
			newString = numString.substring(0,cutoff) + d1.toString();
		}
	}
	if (newString.lastIndexOf(".") == -1) {// Do this again, to the new string
		newString += ".";
	}
	var decs = (newString.substring(newString.lastIndexOf(".")+1)).length;
	for(var i=0;i<decimals-decs;i++) newString += "0";
	//var newNumber = Number(newString);// make it a number if you like
	return newString; // Output the result to the form field (change for your purposes)
}


//周几
function getDay(date) {
	var weekday=new Array(7);
	weekday[0]="周日";
	weekday[1]="周一";
	weekday[2]="周二";
	weekday[3]="周三";
	weekday[4]="周四";
	weekday[5]="周五";
	weekday[6]="周六";
	return weekday[date.getDay()];
}

function getDay2(date) {
	if(date == "Mon") 
		return "周一";
	else if(date == "Tue") 
		return "周二";
	else if(date == "Wed") 
		return "周三";
	else if(date == "Thu") 
		return "周四";
	else if(date == "Fri") 
		return "周五";
	else if(date == "Sat") 
		return "周六";
	else if(date == "Sun") 
		return "周日";
}

//数字加逗号
function addCommas(nStr)
{
 nStr += '';
 x = nStr.split('.');
 x1 = x[0];
 x2 = x.length > 1 ? '.' + x[1] : '';
 var rgx = /(\d+)(\d{3})/;
 while (rgx.test(x1)) {
  x1 = x1.replace(rgx, '$1' + ',' + '$2');
 }
 return x1 + x2;
}

//切换图表类型
function changeChartType(category, type) {	
	if($("#"+category+type+"Tab").hasClass("selbitem") == false) {
		$(".citem").removeClass("selbitem");
		$("#"+category+type+"Tab").addClass("selbitem");
		if(type == "All")
			$("."+category+"Chart").show("blind", {}, 500);	
		else {
			$("."+category+"Chart").hide();
			$("#"+category+type).show("blind", {}, 500);
		}
	}
    
    
    //$("#"+category+"Tableth1").click();
    
     //tableSorting(category+'Table',1); 
    
    //getCSVData_save(category+"Table");

}

// 表格鼠标移动行变色
function tr_hover(obj, hover_css)
{
  obj.mouseover(function() {
	$(this).addClass(hover_css);
  });
  obj.mouseout(function() {
	$(this).removeClass(hover_css);
  });
}

// 判断操作系统
function check_os() {
	var os_type = "MS Windows";
	windows = (navigator.userAgent.indexOf("Windows",0) != -1)?1:0;
	mac = (navigator.userAgent.indexOf("Mac",0) != -1)?1:0;
	linux = (navigator.userAgent.indexOf("Linux",0) != -1)?1:0;
	unix = (navigator.userAgent.indexOf("X11",0) != -1)?1:0;
 
	if (windows) os_type = "MS Windows";
	else if (mac) os_type = "Apple mac";
	else if (linux) os_type = "Lunix";
	else if (unix) os_type = "Unix";
 
	return os_type;
}

//将统计项缩写名字列表转换成全称
function valueFullNameArr(checkedItems) {
	var fullName = new Array();
	for(n=0; n<checkedItems.length; n++) 
	{
		if(checkedItems[n] == "UV")
			fullName.push("使用设备数(UV)");
		else if(checkedItems[n] == "VV")
			fullName.push("播放量(VV)");
        else if(checkedItems[n] == "TU")
			fullName.push("累计用户数(TU)");
		else if(checkedItems[n] == "NU")
			fullName.push("新增设备数(NU)");
		else if(checkedItems[n] == "VVUV")
			fullName.push("VV/UV");
		else if(checkedItems[n] == "Dur")
			fullName.push("播放时长(min)");
		else if(checkedItems[n] == "DurVV")
			fullName.push("播放时长/VV<br>(min)");
		else if(checkedItems[n] == "DurUV")
			fullName.push("播放时长/UV<br>(min)");
		else if(checkedItems[n] == "Comp")
			fullName.push("播放完成量");
		else if(checkedItems[n] == "CompVV")
			fullName.push("播放完成率");
		else if(checkedItems[n] == "BefDurTime")
			fullName.push("播放前<br>平均加载时长<br>(s)");
		else if(checkedItems[n] == "PlayDurTime")
			fullName.push("播放中<br>平均加载时长<br>(s)");
		else if(checkedItems[n] == "PlayTimeVV")
			fullName.push("单次播放<br>平均加载次数");
		else if(checkedItems[n] == "PlayDurVV")
			fullName.push("播放中<br>单次加载平均时长<br>(s)");
		else if(checkedItems[n] == "HDSDDurTime")
			fullName.push("->标清<br>平均加载时长<br>(s)");
		else if(checkedItems[n] == "SDHDDurTime")
			fullName.push("->高清<br>平均加载时长<br>(s)");
        else if(checkedItems[n] == "HD2DurTime")
			fullName.push("->超清<br>平均加载时长<br>(s)");
		else if(checkedItems[n] == "RelateAPIAveRespTime")
			fullName.push("相关接口<br>平均响应时长<br>(s)");
		else if(checkedItems[n] == "VdDetailAPIAveRespTime")
			fullName.push("详情接口<br>平均响应时长<br>(s)");
		else if(checkedItems[n] == "VdUrlAPIAveRespTime")
			fullName.push("视频地址接口<br>平均响应时长<br>(s)");	
		else if(checkedItems[n] == "NR")
			fullName.push("注册用户数(NR)");			
		else if(checkedItems[n] == "SU")
			fullName.push("上传成功量(SU)");
        else if(checkedItems[n] == "FU")
			fullName.push("上传失败量");
        else if(checkedItems[n] == "downloadnum")
			fullName.push("下载量");
        else if(checkedItems[n] == "updatenum")
			fullName.push("更新量");
        else if(checkedItems[n] == "transcodetime")
			fullName.push("平均转码时长(s)");
        else if(checkedItems[n] == "hd")
			fullName.push("高清视频");
        else if(checkedItems[n] == "sd")
			fullName.push("标清视频");
        else if(checkedItems[n] == "hd2")
			fullName.push("超清视频");
        else if(checkedItems[n] == "c01")
			fullName.push("0-1分钟");
        else if(checkedItems[n] == "c12")
			fullName.push("1-2分钟");
        else if(checkedItems[n] == "c23")
			fullName.push("2-3分钟");
        else if(checkedItems[n] == "c34")
			fullName.push("3-4分钟");
        else if(checkedItems[n] == "c45")
			fullName.push("4-5分钟");
        else if(checkedItems[n] == "c5")
			fullName.push(">5分钟");
	}
	return fullName;
}


//将统计项缩写名字转换成全称
function valueFullName(shortName) {
	if(shortName == "UV")
		return("使用设备数(UV)");
	else if(shortName == "VV")
		return("播放量(VV)");
    else if(shortName == "TU")
		return("累计用户数(TU)");
	else if(shortName == "NU")
		return("新增设备数(NU)");
	else if(shortName == "VVUV")
		return("VV/UV");
	else if(shortName == "Dur")
		return("播放时长(min)");
	else if(shortName == "DurVV")
		return("播放时长/VV<br>(min)");
	else if(shortName == "DurUV")
		return("播放时长/UV<br>(min)");
	else if(shortName == "Comp")
		return("播放完成量");
	else if(shortName == "CompVV")
		return("播放完成率");
	else if(shortName == "BefDurTime")
		return("播放前<br>平均加载时长<br>(s)");
	else if(shortName == "PlayDurTime")
		return("播放中<br>平均加载时长<br>(s)");
	else if(shortName == "PlayTimeVV")
		return("单次播放<br>平均加载次数");
	else if(shortName == "PlayDurVV")
		return("播放中<br>单次加载平均时长<br>(s)");
	else if(shortName == "HDSDDurTime")
		return("->标清<br>平均加载时长<br>(s)");
	else if(shortName == "SDHDDurTime")
		return("->高清<br>平均加载时长<br>(s)");
    else if(shortName == "HD2DurTime")
		return("->超清<br>平均加载时长<br>(s)");
	else if(shortName == "RelateAPIAveRespTime")
		return("相关接口<br>平均响应时长<br>(s)");
	else if(shortName == "VdDetailAPIAveRespTime")
		return("详情接口<br>平均响应时长<br>(s)");
	else if(shortName == "VdUrlAPIAveRespTime")
		return("视频地址接口<br>平均响应时长<br>(s)");	
	else if(shortName == "NR")
		return("注册用户数(NR)");			
	else if(shortName == "SU")
		return("上传成功量(SU)");	
    else if(shortName == "downloadnum")
		return("下载量");	
    else if(shortName == "updatenum")
		return("更新量");
    else if(shortName == "transcodetime")
        return("平均转码时长(s)");
    else if(shortName == "hd")
        return("高清视频");
    else if(shortName == "sd")
        return("标清视频");
    else if(shortName == "hd2")
        return("超清视频");
    else if(shortName == "FU")
        return("上传失败量");
    else if(shortName == "c01")
        return("0-1分钟");
    else if(shortName == "c12")
        return("1-2分钟");
    else if(shortName == "c23")
        return("2-3分钟");
    else if(shortName == "c34")
        return("3-4分钟");
    else if(shortName == "c45")
        return("4-5分钟");
    else if(shortName == "c5")
        return(">5分钟");
	else
		return(shortName);

}

//改变时间区域
function changeDateRange(dateRangeID, startDateID, endDateID,_fin) {
	var dateRangeSel  = document.getElementById(dateRangeID);
	var dateRange = dateRangeSel.options[dateRangeSel.selectedIndex].value;
    
    //alert("123");
    
    $.ajax({
		type: "GET",
		url: "/client/checkfinished",
        async:false,
        dataType: "html",
		success: function(msg){
            
            _fin = msg;
           
          }
				});

	if (dateRange != 0)
	{
		var startDate = new Date();
		var endDate = new Date();
		
		var staDay = "00";
		var staMonth = "00";
		var endDay = "00";
		var endMonth = "00";
        
        
        //_fin = "1";
        
        
        if(_fin == "1"){
		endDate.setDate(endDate.getDate()-1);
            
        }else{
            
            
            var zhiriqi = _fin;
                    
                    neyear = zhiriqi.substring(0,4);
                    nem = zhiriqi.substring(4,6);
                    neday = zhiriqi.substring(6,8);
                    
                    gege = neyear+"/"+nem+'/'+neday;
                    var oDate1 = new Date(gege);
            
       //endDate.setDate(endDate.getDate()-1-1);
       //endDate.setDate(endDate.getDate()-1-1-1-1);
       
       endDate = oDate1;
        
        }

		
		startDate.setDate(startDate.getDate()-dateRange);

		if (startDate.getDate() < 10)
			staDay = "0" + startDate.getDate();
		else 
			staDay = startDate.getDate();

		if (startDate.getMonth() < 9)
			staMonth = "0" + (startDate.getMonth()+1);
		else 
			staMonth = startDate.getMonth()+1;
 
		if (endDate.getDate() < 10)
			endDay = "0" + endDate.getDate();
		else 
			endDay = endDate.getDate();
            
      

		if (endDate.getMonth() < 9)
			endMonth = "0" + (endDate.getMonth()+1);
		else 
			endMonth = endDate.getMonth()+1;

        
        //alert(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
        
        
		$("#"+startDateID).val(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
		$("#"+endDateID).val(endDate.getFullYear()+ "/" + endMonth + "/" + endDay);
	}
}



//改变时间区域
function changeDateRange_prodownload(dateRangeID, startDateID, endDateID,_fin) {
	var dateRangeSel  = document.getElementById(dateRangeID);
	var dateRange = dateRangeSel.options[dateRangeSel.selectedIndex].value;
    
    
    $.ajax({
		type: "GET",
		url: "/client/checkfinished",
        async:false,
        dataType: "html",
		success: function(msg){
            
            _fin = msg;
           
          }
				});

	if (dateRange != 0)
	{
		var startDate = new Date();
		var endDate = new Date();
		
		var staDay = "00";
		var staMonth = "00";
		var endDay = "00";
		var endMonth = "00";
        
        
        //_fin = "1";
        
        
        if(_fin == "1"){
		endDate.setDate(endDate.getDate());
            
        }else{
            
       endDate.setDate(endDate.getDate());
        
        }

		
		startDate.setDate(startDate.getDate()-dateRange);

		if (startDate.getDate() < 10)
			staDay = "0" + startDate.getDate();
		else 
			staDay = startDate.getDate();

		if (startDate.getMonth() < 9)
			staMonth = "0" + (startDate.getMonth()+1);
		else 
			staMonth = startDate.getMonth()+1;
 
		if (endDate.getDate() < 10)
			endDay = "0" + endDate.getDate();
		else 
			endDay = endDate.getDate();
            
      

		if (endDate.getMonth() < 9)
			endMonth = "0" + (endDate.getMonth()+1);
		else 
			endMonth = endDate.getMonth()+1;

        
        //alert(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
        
        
		$("#"+startDateID).val(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
		$("#"+endDateID).val(endDate.getFullYear()+ "/" + endMonth + "/" + endDay);
	}
}




//改变时间区域
function newchangetimerange(p,dateRange,_fin) {

    
    
    $.ajax({
		type: "GET",
		url: "/client/checkfinished",
        async:false,
        dataType: "html",
		success: function(msg){
            
            _fin = msg;
           
          }
				});

	if (dateRange != 0)
	{
		var startDate = new Date();
		var endDate = new Date();
		
		var staDay = "00";
		var staMonth = "00";
		var endDay = "00";
		var endMonth = "00";
        
        
        
        if(_fin == "1"){
		endDate.setDate(endDate.getDate()-1);
            
        }else{
            
       endDate.setDate(endDate.getDate()-1-1);
        
        }

		
		startDate.setDate(startDate.getDate()-dateRange);

		if (startDate.getDate() < 10)
			staDay = "0" + startDate.getDate();
		else 
			staDay = startDate.getDate();

		if (startDate.getMonth() < 9)
			staMonth = "0" + (startDate.getMonth()+1);
		else 
			staMonth = startDate.getMonth()+1;
 
		if (endDate.getDate() < 10)
			endDay = "0" + endDate.getDate();
		else 
			endDay = endDate.getDate();
            

		if (endDate.getMonth() < 9)
			endMonth = "0" + (endDate.getMonth()+1);
		else 
			endMonth = endDate.getMonth()+1;


		$("#"+p+"StartDate").val(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
		$("#"+p+"EndDate").val(endDate.getFullYear()+ "/" + endMonth + "/" + endDay);
        
        
        if (p == "NewMainVideo"){
					getNewMainVideoData();

        }else if(p == "NewMainPaike"){
                    getNewMainPaikeData();    
        
        }else if(p == "MainOSDetail_free"){
        
                updateDateRange('MainOSDetail_free');
        }
        else if (p == "outsitesina"){
					getoutsitesinaData();
                }
                
                else if (p == "outsitefb"){
					getoutsitefbData();
                }
                
                else if (p == "dlVideo"){
					getdlVideoData();
    
                }
                
                else if (p == "newboardvideo"){
					getnewboardvideoData();
    
                }
                
                
                else if (p == "channelday"){
					getchanneldayData();
    
                }
                
                else if (p == "retainvideo"){
					getretainvideoData();
    
                }
                
                else if (p == "retainpaike"){
					getretainpaikeData();
    
                }
                
                else if (p == "prodownload"){
					getprodownloadData();
    
                }
                
                else if (p == "retainfactory"){
					getretainfactoryData();
    
                }
                else if (p == "retainchannel"){
					getretainchannelData();
    
                }
                
                else if (p == "citydayvideo"){
					getcitydaynewvideoData();
    
                }
                
                else if (p == "citydaynewvideo"){
					getcitydaynewvideoData();
    
                }
                
                else if (p == "citydaypaike"){
					getcitydaypaikeData();
    
                }
                
                
                else if (p == "newboardpaike"){
					getnewboardpaikeData();
    
                }
                
                else if (p == "dlPaike"){
					getdlPaikeData();
    
                }
                
				else if(p == "FactoryVideo")
				{
					
                    getFactoryVideoData();
                   
				}
				else if (p == "FactoryPaike")
				{
					getFactoryPaikeData();
                   
				}
                
				else if (p == "PromoVideo")
				{
					getPromoVideoData();
	
				}
				else if (p == "PromoPaike")
				{
                    
                    getPromoPaikeData();

				}
			
        
        
        
        
        
        
        
	
    }

}


//改变时间区域
function changeDateRangeboard(dateRangeID, startDateID, endDateID) {
	var dateRangeSel  = document.getElementById(dateRangeID);
	var dateRange = 0;
    
    
    //alert(dateRange);

	
		var startDate = new Date();
		var endDate = new Date();
		
		var staDay = "00";
		var staMonth = "00";
		var endDay = "00";
		var endMonth = "00";

		endDate.setDate(endDate.getDate()-1);
		startDate.setDate(startDate.getDate()-dateRange);

		if (startDate.getDate() < 10)
			staDay = "0" + startDate.getDate();
		else 
			staDay = startDate.getDate();

		if (startDate.getMonth() < 9)
			staMonth = "0" + (startDate.getMonth()+1);
		else 
			staMonth = startDate.getMonth()+1;

		if (endDate.getDate() < 10)
			endDay = "0" + endDate.getDate();
		else 
			endDay = endDate.getDate();

		if (endDate.getMonth() < 9)
			endMonth = "0" + (endDate.getMonth()+1);
		else 
			endMonth = endDate.getMonth()+1;

        
        //alert(startDate.getDate());
        staDay = '01';
        endDay = '04';
        
        //alert(endDay);

		$("#"+startDateID).val(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
		$("#"+endDateID).val(endDate.getFullYear()+ "/" + endMonth + "/" + endDay);
	
}



//改变时间区域
function changeDateRangevidboard(dateRangeID, startDateID, endDateID,_fin) {
	var dateRangeSel  = document.getElementById(dateRangeID);
	var dateRange = 1;
    
    
    //alert(dateRange);

	
		var startDate = new Date();
		var endDate = new Date();
		
		var staDay = "00";
		var staMonth = "00";
		var endDay = "00";
		var endMonth = "00";

		endDate.setDate(endDate.getDate()-1);
		startDate.setDate(startDate.getDate()-dateRange);
        
        if(_fin == "1"){
        
		if (startDate.getDate() < 10)
			staDay = "0" + startDate.getDate();
		else 
			staDay = startDate.getDate();
        
    }else{
        
        
        if (startDate.getDate() < 10)
			staDay = "0" + (startDate.getDate()-1);
		else 
			staDay = startDate.getDate()-1;
        
        
        }

		if (startDate.getMonth() < 9)
			staMonth = "0" + (startDate.getMonth()+1);
		else 
			staMonth = startDate.getMonth()+1;

		if (endDate.getDate() < 10)
			endDay = "0" + endDate.getDate();
		else 
			endDay = endDate.getDate();

		if (endDate.getMonth() < 9)
			endMonth = "0" + (endDate.getMonth()+1);
		else 
			endMonth = endDate.getMonth()+1;

        
        //alert(startDate.getDate());

		$("#"+startDateID).val(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
		//$("#"+endDateID).val(endDate.getFullYear()+ "/" + endMonth + "/" + endDay);
	
}



//改变时间区域
function changeDateRangeph(dateRangeID, startDateID, endDateID,_fin) {
	var dateRangeSel  = document.getElementById(dateRangeID);
	var dateRange = 1;
    
    
    //alert(dateRange);

	
		var startDate = new Date();
		var endDate = new Date();
		
		var staDay = "00";
		var staMonth = "00";
		var endDay = "00";
		var endMonth = "00";

		endDate.setDate(endDate.getDate()-1);
		startDate.setDate(startDate.getDate()-dateRange);
        
        if(_fin == "1"){
        
		if (startDate.getDate() < 10)
			staDay = "0" + startDate.getDate();
		else 
			staDay = startDate.getDate();
        
    }else{
        
        
        if (startDate.getDate() < 10)
			staDay = "0" + (startDate.getDate()-1);
		else 
			staDay = startDate.getDate()-1;
        
        
        }

		if (startDate.getMonth() < 9)
			staMonth = "0" + (startDate.getMonth()+1);
		else 
			staMonth = startDate.getMonth()+1;

		if (endDate.getDate() < 10)
			endDay = "0" + endDate.getDate();
		else 
			endDay = endDate.getDate();

		if (endDate.getMonth() < 9)
			endMonth = "0" + (endDate.getMonth()+1);
		else 
			endMonth = endDate.getMonth()+1;

        
        //alert(startDate.getDate());

		$("#"+startDateID).val(startDate.getFullYear()+ "/" + staMonth + "/" + staDay);
		//$("#"+endDateID).val(endDate.getFullYear()+ "/" + endMonth + "/" + endDay);
	
}


//改变
function changeDate(dateRangeID) {
	document.getElementById(dateRangeID).selectedIndex = 0;
}

//选择全部
function checkAll(e, name) {
	var items = document.getElementsByName(name);
	for(var i=0;i<items.length;i++) {
		items[i].checked = e.checked;
	}
}


function dump_obj(myObject) {
  var s = "";
  for (var property in myObject) {
   s = s + "\n "+property +": " + myObject[property] ;
  }
  alert(s);
}



//读取数据
function readData_ver(data, dateArr, tabName, tabArr, detailArr, checkedItems, sumArr ) {
	var uv, vv, nu, nr, su, dur, comp, befDur, befTimes, playLoadDur, playLoadTimes, playTimeVV, playDurVV, hdsdDur, hdsdTimes, sdhdDur, sdhdTimes, drawResptime, drawTimes, playResptime, playTimes, vdDetailResptime, vdDetailTimes;
	var uvs, vvs, nus, nrs, sus, durs, comps, befDurs, befTimess, playLoadDurs, playLoadTimess, playTimeVVs, playDurVVs, hdsdDurs, hdsdTimess, sdhdDurs, sdhdTimess, drawResptimes, drawTimess, playResptimes, playTimess, vdDetailResptimes, vdDetailTimess;

    //alert(data['items'][0]['data'][0]['fuck']);
    
    //alert(tabArr);
    
	//读取数据
	$(data.items).each(function(i, value){
        
        
		//读取时间
		year = value["year"];
		month = value["month"];
		day = value["day"];
		dateArr.push(year + "/" + month + "/" + day);

		//预设累计数值
		uvs = 0;
        downloadnums = 0;
        updatenums = 0;
		vvs = 0;
		nus = 0;
		nrs = 0;
		sus = 0;
		durs = 0;
		comps = 0;
		befDurs = 0;
		befTimess = 0;
		playLoadDurs = 0;
		playLoadTimess = 0;
		hdsdDurs = 0;
		hdsdTimess = 0;
		sdhdDurs = 0;
		sdhdTimess = 0;
		drawResptimes = 0;
		drawTimess	 = 0;
		playResptimes = 0;
		playTimess = 0;
		vdDetailResptimes = 0;
		vdDetailTimess = 0;

		details = value["data"];
		$(details).each(function(l, dvalue){
			os = dvalue["os"];
			type = dvalue["type"];
			uv = dvalue["uv"]; //每日使用设备数
            downloadnum = dvalue["downloadnum"];
            updatenum = dvalue["updatenum"];
			vv = dvalue["vv"]; //播放总量
			nu = dvalue["nu"]; //新增设备数
			nr = dvalue["nr"]; //注册用户数
			su = dvalue["su"]; //成功上传量		
			dur = dvalue["duration"]/60; //播放时长
			comp = dvalue["complete"]; //播放是否完成
			befDur = dvalue["before_duration"]; //播放前加载时长
			befTimes = dvalue["before_times"]; //播放前加载次数
			playLoadDur = dvalue["play_load_duration"]; //播放中视频加载时长
			playLoadTimes = dvalue["play_load_times"]; //播放中视频加载次数
			hdsdDur = dvalue["play_hdsd_duration"]; //播放中高清到标清加载播放时长
			hdsdTimes = dvalue["play_hdsd_times"]; //播放中高清到标清转换次数
			sdhdDur = dvalue["play_sdhd_duration"]; //播放中标清到高清加载总
			sdhdTimes = dvalue["play_sdhd_times"]; //播放中标清到高清转换次数
			drawResptime = dvalue["draw_resptime"];	//当天的相关视频接口响应总加载时长
			drawTimes	 = dvalue["draw_times"]; //当天相关视频接口响应总加载次数
			playResptime = dvalue["play_resptime"]; //当天的视频地址接口总加载时长
			playTimes = dvalue["play_times"]; //当天视频地址接口总加载次数
			vdDetailResptime = dvalue["getVideoDetail_resptime"]; //当天的视频详情接口总加载时长
			vdDetailTimes = dvalue["getVideoDetail_times"]; //当天视频详情接口总加载次数
			
            
            if (typeof(dvalue["downloadnum"])=="undefined")
				downloadnum = 0;
            if (typeof(dvalue["updatenum"])=="undefined")
				updatenum = 0;
			if (typeof(dvalue["uv"])=="undefined")
				uv = 0;
			if (typeof(dvalue["vv"])=="undefined")
				vv = 0;
			if (typeof(dvalue["nu"])=="undefined")
				nu = 0;
			if (typeof(dvalue["nr"])=="undefined")
				nr = 0;
			if (typeof(dvalue["su"])=="undefined")
				su = 0;
			if (typeof(dvalue["duration"])=="undefined")
				dur = 0;
			if (typeof(dvalue["complete"])=="undefined")
				comp = 0;
			if (typeof(dvalue["before_duration"])=="undefined")
				befDur = 0;
			if (typeof(dvalue["before_times"])=="undefined")
				befTimes = 0;
			if (typeof(dvalue["play_load_duration"])=="undefined")
				playLoadDur = 0;
			if (typeof(dvalue["play_load_times"])=="undefined")
				playLoadTimes = 0;
			if (typeof(dvalue["play_hdsd_duration"])=="undefined")
				hdsdDur = 0;
			if (typeof(dvalue["play_hdsd_times"])=="undefined")
				hdsdTimes = 0;
			if (typeof(dvalue["play_sdhd_duration"])=="undefined")
				sdhdDur = 0;
			if (typeof(dvalue["play_sdhd_times"])=="undefined")
				sdhdTimes = 0;
			if (typeof(dvalue["draw_resptime"])=="undefined")
				drawResptime = 0;
			if (typeof(dvalue["draw_times"])=="undefined")
				drawTimes = 0;
			if (typeof(dvalue["play_resptime"])=="undefined")
				playResptime = 0;
			if (typeof(dvalue["play_times"])=="undefined")
				playTimes = 0;
			if (typeof(dvalue["getVideoDetail_resptime"])=="undefined")
				vdDetailResptime = 0;
			if (typeof(dvalue["getVideoDetail_times"])=="undefined")
				vdDetailTimes = 0;

			//当日累计数值
            downloadnums += downloadnum;
            updatenums += updatenum;
			uvs += uv;
			vvs += vv;
			nus += nu;
			nrs += nr;
			sus += su;
			durs += dur;
			comps += comp;
			befDurs += befDur;
			befTimess += befTimes;
			playLoadDurs += playLoadDur;
			playLoadTimess += playLoadTimes;
			hdsdDurs += hdsdDur;
			hdsdTimess += hdsdTimes;
			sdhdDurs += sdhdDur;
			sdhdTimess += sdhdTimes;
			drawResptimes += drawResptime;
			drawTimess	 += drawTimes;
			playResptimes += playResptime;
			playTimess += playTimes;
			vdDetailResptimes += vdDetailResptime;
			vdDetailTimess += vdDetailTimes;

			if (tabName != "")
			{
				tabIndex = in_array(dvalue[tabName],tabArr);
				if (tabIndex > -1)
				{
					if(dateArr.length-detailArr[tabIndex][0].length > 1) {
                        
                        alert('123');
						var size = dateArr.length-detailArr[tabIndex][0].length;
						for(l=1; l<size; l++) {
							for(n=0; n<checkedItems.length; n++) 
								detailArr[tabIndex][n] = new Array();
						}
					}
					
					//每日分开数据
					for(n=0; n<checkedItems.length; n++) 
					{
						if (checkedItems[n] == "UV")
							detailArr[tabIndex][n].push(uv);
						else if (checkedItems[n] == "VV")
							detailArr[tabIndex][n].push(vv);
                        else if (checkedItems[n] == "downloadnum")
							detailArr[tabIndex][n].push(downloadnum);
                        else if (checkedItems[n] == "updatenum")
							detailArr[tabIndex][n].push(updatenum);
						else if (checkedItems[n] == "NU")
							detailArr[tabIndex][n].push(nu);
						else if (checkedItems[n] == "NR")
							detailArr[tabIndex][n].push(nr);
						else if (checkedItems[n] == "SU")
							detailArr[tabIndex][n].push(su);
						else if (checkedItems[n] == "VVUV") {
							if (uv == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(vv/uv);
						}
						else if (checkedItems[n] == "Dur")
							detailArr[tabIndex][n].push(dur);
						else if (checkedItems[n] == "DurVV") {
							if (dur == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(dur/vv);
						}
						else if (checkedItems[n] == "DurUV") {
							if (dur == 0 || uv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(dur/uv);
						}
						else if (checkedItems[n] == "Comp")
							detailArr[tabIndex][n].push(comp);
						else if (checkedItems[n] == "CompVV") {
							if (comp == 0 || vv == 0 || comp/vv < 0.0001)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push((comp/vv)*100);
						}
						else if (checkedItems[n] == "BefDurTime") {
							if (befDur == 0 || befTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(befDur/befTimes/1000);
						}
						else if (checkedItems[n] == "PlayDurTime") {
							if (playLoadDur == 0 || playLoadTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playLoadDur/playLoadTimes/1000);
						}
						else if (checkedItems[n] == "PlayTimeVV") {
							if (playLoadTimes == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playLoadTimes/vv);
						}
						else if (checkedItems[n] == "PlayDurVV") {
							if (playLoadDur == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playLoadDur/vv/1000);
						}
						else if (checkedItems[n] == "HDSDDurTime") {
							if (hdsdDur == 0 || hdsdTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(hdsdDur/hdsdTimes/1000);
						}
						else if (checkedItems[n] == "SDHDDurTime") {
							if (sdhdDur == 0 || sdhdTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(sdhdDur/sdhdTimes/1000);
						}
						else if (checkedItems[n] == "RelateAPIAveRespTime") {
							if (drawResptime == 0 || drawTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(drawResptime/drawTimes/1000);
						}
						else if (checkedItems[n] == "VdDetailAPIAveRespTime") {
							if (vdDetailResptime == 0 || vdDetailTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(vdDetailResptime/vdDetailTimes/1000);
						}
						else if (checkedItems[n] == "VdUrlAPIAveRespTime") {
							if (playResptime == 0 || playTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playResptime/playTimes/1000);
						}
					}
				}
			}

		});
		//每日累计数据
		for(n=0; n<checkedItems.length; n++) 
		{
			if (checkedItems[n] == "UV")
				sumArr[n].push(uvs);
			else if (checkedItems[n] == "VV")
				sumArr[n].push(vvs);
            else if (checkedItems[n] == "downloadnum")
				sumArr[n].push(downloadnums);
            else if (checkedItems[n] == "updatenum")
				sumArr[n].push(updatenums);
			else if (checkedItems[n] == "NU")
				sumArr[n].push(nus);
			else if (checkedItems[n] == "VVUV") {
				if (uvs == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(vvs/uvs);
			}
			else if (checkedItems[n] == "NR")
				sumArr[n].push(nrs);
			else if (checkedItems[n] == "SU")
				sumArr[n].push(sus);
			else if (checkedItems[n] == "Dur")
				sumArr[n].push(durs);
			else if (checkedItems[n] == "DurVV") {
				if (durs == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(durs/vvs);
			}
			else if (checkedItems[n] == "DurUV") {
				if (durs== 0 || uvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(durs/uvs);
			}
			else if (checkedItems[n] == "Comp")
				sumArr[n].push(comps);
			else if (checkedItems[n] == "CompVV") {
				if (comps == 0 || vvs == 0 || comps/vvs < 0.0001)
					sumArr[n].push(0);
				else
					sumArr[n].push((comps/vvs)*100);
			}
			else if (checkedItems[n] == "BefDurTime") {
				if (befDurs == 0 || befTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(befDurs/befTimess/1000);
			}
			else if (checkedItems[n] == "PlayDurTime") {
				if (playLoadDurs == 0 || playLoadTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playLoadDurs/playLoadTimess/1000);
			}
			else if (checkedItems[n] == "PlayTimeVV") {
				if (playLoadTimess == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playLoadTimess/vvs);
			}
			else if (checkedItems[n] == "PlayDurVV") {
				if (playLoadDurs == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playLoadDurs/vvs/1000);
			}
			else if (checkedItems[n] == "HDSDDurTime") {
				if (hdsdDurs == 0 || hdsdTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(hdsdDurs/hdsdTimess/1000);
			}
			else if (checkedItems[n] == "SDHDDurTime") {
				if (sdhdDurs == 0 || sdhdTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(sdhdDurs/sdhdTimess/1000);
			}
			else if (checkedItems[n] == "RelateAPIAveRespTime") {
				if (drawResptimes == 0 || drawTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(drawResptimes/drawTimess/1000);
			}
			else if (checkedItems[n] == "VdDetailAPIAveRespTime") {
				if (vdDetailResptimes == 0 || vdDetailTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(vdDetailResptimes/vdDetailTimess/1000);
			}
			else if (checkedItems[n] == "VdUrlAPIAveRespTime") {
				if (playResptimes == 0 || playTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playResptimes/playTimess/1000);
			}
		}
	});
}


//读取数据
function readData(data, dateArr, tabName, tabArr, detailArr, checkedItems, sumArr ) {
	var uv, vv, nu, nr, su, dur, comp, befDur, befTimes, playLoadDur, playLoadTimes, playTimeVV, playDurVV, hdsdDur, hdsdTimes, sdhdDur, sdhdTimes, drawResptime, drawTimes, playResptime, playTimes, vdDetailResptime, vdDetailTimes;
	var uvs, vvs, nus, nrs, sus, durs, comps, befDurs, befTimess, playLoadDurs, playLoadTimess, playTimeVVs, playDurVVs, hdsdDurs, hdsdTimess, sdhdDurs, sdhdTimess, drawResptimes, drawTimess, playResptimes, playTimess, vdDetailResptimes, vdDetailTimess;

    //alert(data['items'][0]['data'][0]['fuck']);
    
    //alert(tabArr);
    
	//读取数据
	$(data.items).each(function(i, value){
        
        
		//读取时间
		year = value["year"];
		month = value["month"];
		day = value["day"];
		dateArr.push(year + "/" + month + "/" + day);

		//预设累计数值
		uvs = 0;
        downloadnums = 0;
        updatenums = 0;
		vvs = 0;
		nus = 0;
		nrs = 0;
		sus = 0;
		durs = 0;
		comps = 0;
		befDurs = 0;
		befTimess = 0;
		playLoadDurs = 0;
		playLoadTimess = 0;
		hdsdDurs = 0;
		hdsdTimess = 0;
		sdhdDurs = 0;
		sdhdTimess = 0;
		drawResptimes = 0;
		drawTimess	 = 0;
		playResptimes = 0;
		playTimess = 0;
		vdDetailResptimes = 0;
		vdDetailTimess = 0;

		details = value["data"];
		$(details).each(function(l, dvalue){
			os = dvalue["os"];
			type = dvalue["type"];
			uv = dvalue["uv"]; //每日使用设备数
            downloadnum = dvalue["downloadnum"];
            updatenum = dvalue["updatenum"];
			vv = dvalue["vv"]; //播放总量
			nu = dvalue["nu"]; //新增设备数
			nr = dvalue["nr"]; //注册用户数
			su = dvalue["su"]; //成功上传量		
			dur = dvalue["duration"]/60; //播放时长
			comp = dvalue["complete"]; //播放是否完成
			befDur = dvalue["before_duration"]; //播放前加载时长
			befTimes = dvalue["before_times"]; //播放前加载次数
			playLoadDur = dvalue["play_load_duration"]; //播放中视频加载时长
			playLoadTimes = dvalue["play_load_times"]; //播放中视频加载次数
			hdsdDur = dvalue["play_hdsd_duration"]; //播放中高清到标清加载播放时长
			hdsdTimes = dvalue["play_hdsd_times"]; //播放中高清到标清转换次数
			sdhdDur = dvalue["play_sdhd_duration"]; //播放中标清到高清加载总
			sdhdTimes = dvalue["play_sdhd_times"]; //播放中标清到高清转换次数
			drawResptime = dvalue["draw_resptime"];	//当天的相关视频接口响应总加载时长
			drawTimes	 = dvalue["draw_times"]; //当天相关视频接口响应总加载次数
			playResptime = dvalue["play_resptime"]; //当天的视频地址接口总加载时长
			playTimes = dvalue["play_times"]; //当天视频地址接口总加载次数
			vdDetailResptime = dvalue["getVideoDetail_resptime"]; //当天的视频详情接口总加载时长
			vdDetailTimes = dvalue["getVideoDetail_times"]; //当天视频详情接口总加载次数
			
            
            if (typeof(dvalue["downloadnum"])=="undefined")
				downloadnum = 0;
            if (typeof(dvalue["updatenum"])=="undefined")
				updatenum = 0;
			if (typeof(dvalue["uv"])=="undefined")
				uv = 0;
			if (typeof(dvalue["vv"])=="undefined")
				vv = 0;
			if (typeof(dvalue["nu"])=="undefined")
				nu = 0;
			if (typeof(dvalue["nr"])=="undefined")
				nr = 0;
			if (typeof(dvalue["su"])=="undefined")
				su = 0;
			if (typeof(dvalue["duration"])=="undefined")
				dur = 0;
			if (typeof(dvalue["complete"])=="undefined")
				comp = 0;
			if (typeof(dvalue["before_duration"])=="undefined")
				befDur = 0;
			if (typeof(dvalue["before_times"])=="undefined")
				befTimes = 0;
			if (typeof(dvalue["play_load_duration"])=="undefined")
				playLoadDur = 0;
			if (typeof(dvalue["play_load_times"])=="undefined")
				playLoadTimes = 0;
			if (typeof(dvalue["play_hdsd_duration"])=="undefined")
				hdsdDur = 0;
			if (typeof(dvalue["play_hdsd_times"])=="undefined")
				hdsdTimes = 0;
			if (typeof(dvalue["play_sdhd_duration"])=="undefined")
				sdhdDur = 0;
			if (typeof(dvalue["play_sdhd_times"])=="undefined")
				sdhdTimes = 0;
			if (typeof(dvalue["draw_resptime"])=="undefined")
				drawResptime = 0;
			if (typeof(dvalue["draw_times"])=="undefined")
				drawTimes = 0;
			if (typeof(dvalue["play_resptime"])=="undefined")
				playResptime = 0;
			if (typeof(dvalue["play_times"])=="undefined")
				playTimes = 0;
			if (typeof(dvalue["getVideoDetail_resptime"])=="undefined")
				vdDetailResptime = 0;
			if (typeof(dvalue["getVideoDetail_times"])=="undefined")
				vdDetailTimes = 0;

			//当日累计数值
            downloadnums += downloadnum;
            updatenums += updatenum;
			uvs += uv;
			vvs += vv;
			nus += nu;
			nrs += nr;
			sus += su;
			durs += dur;
			comps += comp;
			befDurs += befDur;
			befTimess += befTimes;
			playLoadDurs += playLoadDur;
			playLoadTimess += playLoadTimes;
			hdsdDurs += hdsdDur;
			hdsdTimess += hdsdTimes;
			sdhdDurs += sdhdDur;
			sdhdTimess += sdhdTimes;
			drawResptimes += drawResptime;
			drawTimess	 += drawTimes;
			playResptimes += playResptime;
			playTimess += playTimes;
			vdDetailResptimes += vdDetailResptime;
			vdDetailTimess += vdDetailTimes;

			if (tabName != "")
			{
				tabIndex = in_array(dvalue[tabName],tabArr);
				if (tabIndex > -1)
				{
					if(dateArr.length-detailArr[tabIndex][0].length > 1) {
						var size = dateArr.length-detailArr[tabIndex][0].length;
						for(l=1; l<size; l++) {
							for(n=0; n<checkedItems.length; n++) 
								detailArr[tabIndex][n] = new Array();
						}
					}
					
					//每日分开数据
					for(n=0; n<checkedItems.length; n++) 
					{
						if (checkedItems[n] == "UV")
							detailArr[tabIndex][n].push(uv);
						else if (checkedItems[n] == "VV")
							detailArr[tabIndex][n].push(vv);
                        else if (checkedItems[n] == "downloadnum")
							detailArr[tabIndex][n].push(downloadnum);
                        else if (checkedItems[n] == "updatenum")
							detailArr[tabIndex][n].push(updatenum);
						else if (checkedItems[n] == "NU")
							detailArr[tabIndex][n].push(nu);
						else if (checkedItems[n] == "NR")
							detailArr[tabIndex][n].push(nr);
						else if (checkedItems[n] == "SU")
							detailArr[tabIndex][n].push(su);
						else if (checkedItems[n] == "VVUV") {
							if (uv == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(vv/uv);
						}
						else if (checkedItems[n] == "Dur")
							detailArr[tabIndex][n].push(dur);
						else if (checkedItems[n] == "DurVV") {
							if (dur == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(dur/vv);
						}
						else if (checkedItems[n] == "DurUV") {
							if (dur == 0 || uv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(dur/uv);
						}
						else if (checkedItems[n] == "Comp")
							detailArr[tabIndex][n].push(comp);
						else if (checkedItems[n] == "CompVV") {
							if (comp == 0 || vv == 0 || comp/vv < 0.0001)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push((comp/vv)*100);
						}
						else if (checkedItems[n] == "BefDurTime") {
							if (befDur == 0 || befTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(befDur/befTimes/1000);
						}
						else if (checkedItems[n] == "PlayDurTime") {
							if (playLoadDur == 0 || playLoadTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playLoadDur/playLoadTimes/1000);
						}
						else if (checkedItems[n] == "PlayTimeVV") {
							if (playLoadTimes == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playLoadTimes/vv);
						}
						else if (checkedItems[n] == "PlayDurVV") {
							if (playLoadDur == 0 || vv == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playLoadDur/vv/1000);
						}
						else if (checkedItems[n] == "HDSDDurTime") {
							if (hdsdDur == 0 || hdsdTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(hdsdDur/hdsdTimes/1000);
						}
						else if (checkedItems[n] == "SDHDDurTime") {
							if (sdhdDur == 0 || sdhdTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(sdhdDur/sdhdTimes/1000);
						}
						else if (checkedItems[n] == "RelateAPIAveRespTime") {
							if (drawResptime == 0 || drawTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(drawResptime/drawTimes/1000);
						}
						else if (checkedItems[n] == "VdDetailAPIAveRespTime") {
							if (vdDetailResptime == 0 || vdDetailTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(vdDetailResptime/vdDetailTimes/1000);
						}
						else if (checkedItems[n] == "VdUrlAPIAveRespTime") {
							if (playResptime == 0 || playTimes == 0)
								detailArr[tabIndex][n].push(0);
							else
								detailArr[tabIndex][n].push(playResptime/playTimes/1000);
						}
					}
				}
			}

		});
		//每日累计数据
		for(n=0; n<checkedItems.length; n++) 
		{
			if (checkedItems[n] == "UV")
				sumArr[n].push(uvs);
			else if (checkedItems[n] == "VV")
				sumArr[n].push(vvs);
            else if (checkedItems[n] == "downloadnum")
				sumArr[n].push(downloadnums);
            else if (checkedItems[n] == "updatenum")
				sumArr[n].push(updatenums);
			else if (checkedItems[n] == "NU")
				sumArr[n].push(nus);
			else if (checkedItems[n] == "VVUV") {
				if (uvs == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(vvs/uvs);
			}
			else if (checkedItems[n] == "NR")
				sumArr[n].push(nrs);
			else if (checkedItems[n] == "SU")
				sumArr[n].push(sus);
			else if (checkedItems[n] == "Dur")
				sumArr[n].push(durs);
			else if (checkedItems[n] == "DurVV") {
				if (durs == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(durs/vvs);
			}
			else if (checkedItems[n] == "DurUV") {
				if (durs== 0 || uvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(durs/uvs);
			}
			else if (checkedItems[n] == "Comp")
				sumArr[n].push(comps);
			else if (checkedItems[n] == "CompVV") {
				if (comps == 0 || vvs == 0 || comps/vvs < 0.0001)
					sumArr[n].push(0);
				else
					sumArr[n].push((comps/vvs)*100);
			}
			else if (checkedItems[n] == "BefDurTime") {
				if (befDurs == 0 || befTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(befDurs/befTimess/1000);
			}
			else if (checkedItems[n] == "PlayDurTime") {
				if (playLoadDurs == 0 || playLoadTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playLoadDurs/playLoadTimess/1000);
			}
			else if (checkedItems[n] == "PlayTimeVV") {
				if (playLoadTimess == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playLoadTimess/vvs);
			}
			else if (checkedItems[n] == "PlayDurVV") {
				if (playLoadDurs == 0 || vvs == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playLoadDurs/vvs/1000);
			}
			else if (checkedItems[n] == "HDSDDurTime") {
				if (hdsdDurs == 0 || hdsdTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(hdsdDurs/hdsdTimess/1000);
			}
			else if (checkedItems[n] == "SDHDDurTime") {
				if (sdhdDurs == 0 || sdhdTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(sdhdDurs/sdhdTimess/1000);
			}
			else if (checkedItems[n] == "RelateAPIAveRespTime") {
				if (drawResptimes == 0 || drawTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(drawResptimes/drawTimess/1000);
			}
			else if (checkedItems[n] == "VdDetailAPIAveRespTime") {
				if (vdDetailResptimes == 0 || vdDetailTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(vdDetailResptimes/vdDetailTimess/1000);
			}
			else if (checkedItems[n] == "VdUrlAPIAveRespTime") {
				if (playResptimes == 0 || playTimess == 0)
					sumArr[n].push(0);
				else
					sumArr[n].push(playResptimes/playTimess/1000);
			}
		}
	});
}

//显示选择Tab
function genTabs(pageName, optionName, tabArr, detailArr, sumArr, checkedItems) {
	var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();

	$("#"+pageName+"Tab").html(tab);
    
    
    //tableSorting(pageName+'Table', 1);
    
    
}

//显示选择Tab
function genTabsdl(pageName, optionName, tabArr, detailArr, sumArr, checkedItems) {
	//var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
    var tab = "";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();
        
        if (i == 1){
		tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem selbitem\">"+
        tabName+"</div>";}
        else{tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem\">"+
        tabName+"</div>";}
	
    
    }
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();

	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsboard(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
	//var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
    var tab = "";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();
        
        
        if(sork == "0"){
        
        
        if (i == 1){
		tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem selbitem\">"+
        tabName+"</div>";}
        else{tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem\">"+
        tabName+"</div>";}
        
        
      }else{
          
      if (i == 2){
		tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem selbitem\">"+
        tabName+"</div>";}
        else{tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem\">"+
        tabName+"</div>";}
      
      
  }
        
        
        
	
    
    }
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();

	$("#"+pageName+"Tab").html(tab);
}
//显示选择Tab
function genTabschannelday(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsretainvideo(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabsretainpaike(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabsretainfactory(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabsretainchannel(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabsnewboardvideo(pageName) {
    
    var tab = "";
    var optionName = "";
    
    var tabName = "Phone";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem selbitem\">"+tabName+"</div>";
    
    tabName = "Pad";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	
	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsvidboard(pageName) {
    
    var tab = "";
    var optionName = "";
    
    var tabName = "day";
    var tabName_han = "日";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem selbitem\">"+tabName_han+"</div>";
    
    tabName = "week";
    var tabName_han = "周";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName_han+"</div>";
	
	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsph(pageName) {
    
    var tab = "";
    var optionName = "";
    
    var tabName = "day";
    var tabName_han = "日";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem selbitem\">"+tabName_han+"</div>";
    
    tabName = "week";
    var tabName_han = "周";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName_han+"</div>";
    
    tabName = "month";
    var tabName_han = "月";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName_han+"</div>";
	
	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsnewboardpaike(pageName) {
    
    var tab = "";
    var optionName = "";
    
    var tabName = "Phone";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem selbitem\">"+tabName+"</div>";
    
	
	$("#"+pageName+"Tab").html(tab);
}


function checkSys(){if(navigator.userAgent.indexOf("Window")>0){return "windows";}else if(navigator.userAgent.indexOf("Mac OS X")>0) {return "linux";}else if(navigator.userAgent.indexOf("Linux")>0) {return "linux";}else{return "linux";}}


//显示选择Tab
function genTabsoutsite(pageName) {
    
    var tab = "";
    var optionName = "";
    
    var tabName = "总览";
    tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem selbitem\">"+tabName+"</div>";
    
	
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabsHuoYueVideo(pageName,optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
}
	$("#"+pageName+"Tab").html(tab);
}

//显示选择Tab
function genTabsHuoYuePaike(pageName,optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabscitydayvideo(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    if(sork != "All"){
    
    if(optionName == "citydayvideoOS"){
    

    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('61,59,52','"+optionName+"','All')\" class=\"bitem\">总览</div>";
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('1,2','"+optionName+"','All')\" class=\"bitem\">总览</div>";
    
    
    }
}else{
    
    if(optionName == "citydayvideoOS"){
    

    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('61,59,52','"+optionName+"','All')\" class=\"bitem selbitem\">总览</div>";
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('1,2','"+optionName+"','All')\" class=\"bitem selbitem\">总览</div>";
    
    
    }
    
    
    
    }
    
    
    
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
        var tabv = document.getElementById(optionName).options[i].value;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();
        
        if(sork != tabName){
		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabv +"', '"+optionName+"','"+tabName+"')\" class=\"bitem\">"+tabName+"</div>";
    }else{
        tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabv +"', '"+optionName+"','"+tabName+"')\" class=\"bitem selbitem\">"+tabName+"</div>";
        
        }
	
    
    
    }
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabsnewmainvideo(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    
    
    $("#mainbefdurationbox").html("All"+","+optionName);
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All','"+ optionName +"')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
        
        var cbName = "";
    if(tabName=="渠道推广"){
    
    cbName = 'qudao';
}else if(tabName == "厂商内置"){
    cbName = "changshang"
}else{cbName = tabName; }
        
        
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ cbName +"\" onclick=\"change"+pageName+"Tab('"+ cbName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) {
		sumArr[n] = new Array();
        
    }
        
    
}
	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsnewmainpaike(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    $("#mainpaikebefdurationbox").html("All"+","+optionName);
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
        
        var cbName = "";
    if(tabName=="渠道推广"){
    
    cbName = 'qudao';
}else if(tabName == "厂商内置"){
    cbName = "changshang"
}else{cbName = tabName; }
        
        
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ cbName +"\" onclick=\"change"+pageName+"Tab('"+ cbName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabscitydaypaike(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}



//显示选择Tab
function genTabscitydaynewvideo(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
    
    if(optionName == ""){
    
    var tab = "";
    
}else{
    
    var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();

		tab += "<div id=\""+pageName+"Tab"+ tabName +"\" onclick=\"change"+pageName+"Tab('"+ tabName +"', '"+optionName+"')\" class=\"bitem\">"+tabName+"</div>";
	}
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();
}
	$("#"+pageName+"Tab").html(tab);
}


//显示选择Tab
function genTabsdlHelp(pageName, optionName, tabArr, detailArr, sumArr, checkedItems,sork) {
	//var tab = "<div id=\""+ pageName +"TabAll\" onclick=\"change"+pageName+"Tab('All')\" class=\"bitem selbitem\">总览</div>";
    var tab = "";
	for(i=1; i<document.getElementById(optionName).options.length; i++) {
		var tabName = document.getElementById(optionName).options[i].text;
		tabArr.push(tabName);
		detailArr[i-1] = new Array();
		for(n=0; n<checkedItems.length; n++) 
			detailArr[i-1][n] = new Array();
        
        
        if(sork == "0"){
        
        
        if (i == 1){
		tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem selbitem\">"+
        tabName+"</div>";}
        else{tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem\">"+
        tabName+"</div>";}
        
        
      }else{
          
      if (i == 2){
		tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem selbitem\">"+
        tabName+"</div>";}
        else{tab += "<div id=\""+pageName+"Tab"+ (i-1) +"\" onclick=\"change"+pageName+"Tab('"+ (i-1) +"', '"+optionName+"')\" class=\"bitem\">"+
        tabName+"</div>";}
      
      
  }
        
        
        
	
    
    }
	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();

	$("#"+pageName+"Tab").html(tab);
}





function genDeviceTabs(pageName, checkboxName, tabArr, detailArr, sumArr, checkedItems) {
	var tab = "";
	var items = document.getElementsByName(checkboxName);
	var l = 0;
	for(var i=0;i<items.length;i++) {
		if (items[i].checked) {
			tabArr.push(items[i].id);
			detailArr[l] = new Array();
			for(n=0; n<checkedItems.length; n++) 
				detailArr[l][n] = new Array();
			if (l == 0)
				tab += "<div id=\""+pageName+"Tab"+ l +"\" onclick=\"change"+pageName+"Tab('"+ l +"', '"+checkboxName+"')\" class=\"bitem selbitem\">"+items[i].id+"</div>";
			else
				tab += "<div id=\""+pageName+"Tab"+ l +"\" onclick=\"change"+pageName+"Tab('"+ l +"', '"+checkboxName+"')\" class=\"bitem\">"+items[i].id+"</div>";
			l++;
		}
	}

	for(n=0; n<checkedItems.length; n++) 
		sumArr[n] = new Array();

	$("#"+pageName+"Tab").html(tab);
}




//读取数据
function readSummaryData(data, dateArr, tabName, tabArr, detailArr, checkedItems ) {
	var uv, vv, nu, fname, os,downloadnum,updatenum;

	//读取数据
	$(data.items).each(function(i, dvalue){
		uv = dvalue["uv"]; //每日使用设备数
		vv = dvalue["vv"]; //播放总量
		nu = dvalue["nu"]; //新增设备数
		fname = dvalue["fname"];
        downloadnum = dvalue["downloadnum"];
        updatenum = dvalue["updatenum"];
		os = dvalue["os"];
				
		if (typeof(dvalue["uv"])=="undefined")
			uv = 0;
		if (typeof(dvalue["vv"])=="undefined")
			vv = 0;
		if (typeof(dvalue["nu"])=="undefined")
			nu = 0;
        if (typeof(dvalue["downloadnum"])=="undefined")
			downloadnum = 0;
        if (typeof(dvalue["updatenum "])=="undefined")
			updatenum = 0;

		if (tabName != "")
		{
			tabIndex = in_array(dvalue[tabName], tabArr);
			if (tabIndex > -1)
			{	
				detailArr[tabIndex].fname = fname;
				detailArr[tabIndex].os = os;

				for(n=0; n<checkedItems.length; n++) 
				{
					if (checkedItems[n] == "UV")
						detailArr[tabIndex].UV = uv;
					else if (checkedItems[n] == "VV")
						detailArr[tabIndex].VV = vv;
					else if (checkedItems[n] == "NU")
						detailArr[tabIndex].NU = nu;
					else if (checkedItems[n] == "VVUV") {
						if (uv == 0 || vv == 0)
							detailArr[tabIndex].VVUV = 0;
						else
							detailArr[tabIndex].VVUV = vv/uv;
					}
				}
			}
		}
	});
}


//by函数接受一个成员名字符串做为参数  
//并返回一个可以用来对包含该成员的对象数组进行排序的比较函数  
var by = function(name){  
    return function(o, p){  
        var a, b;  
        if (typeof o === "object" && typeof p === "object" && o && p) {  
            a = o[name];  
            b = p[name];  
            if (a === b) {  
                return 0;  
            }  
            if (typeof a === typeof b) {  
                return a > b ? -1 : 1;  
            }  
            return typeof a > typeof b ? -1 : 1;  
        }  
        else {  
            throw ("error");  
        }  
    }  
}

function befdurationbox(type){
    
    var content = $("#mainbefdurationbox").html();
    
    var osID = document.getElementById("NewMainVideoOS").options[document.getElementById("NewMainVideoOS").selectedIndex].value;
	var typeID = document.getElementById("NewMainVideoType").options[document.getElementById("NewMainVideoType").selectedIndex].value;
	var marketID = document.getElementById("NewMainVideoMarket").options[document.getElementById("NewMainVideoMarket").selectedIndex].value;
    
    if(osID != "" && typeID != "" && marketID != ""){
        
        mainfreeboxduration(osID,typeID,marketID,"总览",type);
        
        
    
    }else{
    
    
    var clist = content.split(",");
    var shu = clist[0];
    var weidu = clist[1];
    
    
    if(weidu == "NewMainVideoOS"){
        
        if(typeID==""){
        typeID = "1,2";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        osID = zhuanyiyi("os",shu);
        
    }else if(weidu == "NewMainVideoType"){
        
        if(osID==""){
        typeID = "61,52,59";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        typeID = zhuanyiyi("dt",shu);
        
    }else if(weidu == "NewMainVideoMarket"){
        
        if(typeID==""){
        typeID = "1,2";
        }
        if(osID==""){
            osID = "61,52,59";
        }
        
        marketID = zhuanyiyi("pm",shu);
        
    }
    
    if(shu == "All"){
    
       shu = "总览";
    
    }
    
    mainfreeboxduration(osID,typeID,marketID,shu,type);
    
    }
    
}



function localvvbox(s_type){
    
    if(s_type == "NewMainVideo"){
    
    var content = $("#mainbefdurationbox").html();
    
    }else{
    
    var content = $("#mainpaikebefdurationbox").html();
    
    }
    
    var osID = document.getElementById(s_type+"OS").options[document.getElementById(s_type+"OS").selectedIndex].value;
	var typeID = document.getElementById(s_type+"Type").options[document.getElementById(s_type+"Type").selectedIndex].value;
	var marketID = document.getElementById(s_type+"Market").options[document.getElementById(s_type+"Market").selectedIndex].value;
    
    if(osID != "" && typeID != "" && marketID != ""){
        
        mainfreeboxlocalvv(osID,typeID,marketID,"总览",s_type);
        
        
    
    }else{
    
    
    var clist = content.split(",");
    var shu = clist[0];
    var weidu = clist[1];
    
    
    if(s_type == "NewMainVideo"){
    
    if(weidu == "NewMainVideoOS"){
        
        if(typeID==""){
        typeID = "1,2";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        osID = zhuanyiyi("os",shu);
        
    }else if(weidu == "NewMainVideoType"){
        
        if(osID==""){
        typeID = "61,52,59";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        typeID = zhuanyiyi("dt",shu);
        
    }else if(weidu == "NewMainVideoMarket"){
        
        if(typeID==""){
        typeID = "1,2";
        }
        if(osID==""){
            osID = "61,52,59";
        }
        
        marketID = zhuanyiyi("pm",shu);
        
    }
}else{
    
    
    if(weidu == "NewMainPaikeOS"){
        
        if(typeID==""){
        typeID = "1";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        osID = zhuanyiyi("os",shu);
        
    }else if(weidu == "NewMainPaikeType"){
        
        if(osID==""){
        typeID = "61,52";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        typeID = zhuanyiyi("dt",shu);
        
    }else if(weidu == "NewMainPaikeMarket"){
        
        if(typeID==""){
        typeID = "1";
        }
        if(osID==""){
            osID = "61,52";
        }
        
        marketID = zhuanyiyi("pm",shu);
        
    }
    
    


}
    
    
    
    
    if(shu == "All"){
    
       shu = "总览";
    
    }
    
    mainfreeboxlocalvv(osID,typeID,marketID,shu,s_type);
    
    }
    
}



function befdurationbox_ver(type){
    
    var content = $("#mainbefdurationbox").html();
    
    var osID = document.getElementById("NewMainVideoOS").options[document.getElementById("NewMainVideoOS").selectedIndex].value;
	var typeID = document.getElementById("NewMainVideoType").options[document.getElementById("NewMainVideoType").selectedIndex].value;
	var marketID = document.getElementById("NewMainVideoMarket").options[document.getElementById("NewMainVideoMarket").selectedIndex].value;
    
    
    var veritems = document.getElementsByName("NewMainVideoCheckbox3");
    var _itemsver = "";
    for(var i=0;i<veritems.length;i++) {
			if (veritems[i].checked)
			{
                _itemsver += veritems[i].value + ",";

			}
		}
    
    
    
    if(osID != "" && typeID != "" && marketID != ""){
        
        mainfreeboxduration(osID,typeID,marketID,"总览",type,_itemsver);
        
        
    
    }else{
    
    
    var clist = content.split(",");
    var shu = clist[0];
    var weidu = clist[1];
    
    
    if(weidu == "NewMainVideoOS"){
        
        if(typeID==""){
        typeID = "1,2";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        osID = zhuanyiyi("os",shu);
        
    }else if(weidu == "NewMainVideoType"){
        
        if(osID==""){
        typeID = "61,52,59";
        }
        if(marketID==""){
            marketID = "1,3,2,8";
        }
        
        typeID = zhuanyiyi("dt",shu);
        
    }else if(weidu == "NewMainVideoMarket"){
        
        if(typeID==""){
        typeID = "1,2";
        }
        if(osID==""){
            osID = "61,52,59";
        }
        
        marketID = zhuanyiyi("pm",shu);
        
    }
    
    if(shu == "All"){
    
       shu = "总览";
    
    }
    
    mainfreeboxduration_ver(osID,typeID,marketID,shu,type,_itemsver);
    
    }
    
}


function mainfreeboxduration_ver(osID,typeID,marketID,title,type,_itemsver){
    
    
    if(type == "beforedurationmain_ver"){
      tname = "播放前加载";
    }else{
    
        tname = "播放中加载";
    
    }
    
    
    var veritems = document.getElementsByName("NewMainVideoCheckbox3");
    _vers = new Array();
    for(var i=0;i<veritems.length;i++) {
			if (veritems[i].checked)
			{
                _vers.push(veritems[i].value);

			}
		}
    
    
    
    var startDate = $("#NewMainVideoStartDate").val();
	var endDate = $("#NewMainVideoEndDate").val();
    
    
    var start = new Date();
    var end = new Date();
    
    
    start.setFullYear(startDate.substring(0,4), startDate.substring(5,7)-1, startDate.substring(8,10));
    end.setFullYear(endDate.substring(0,4), endDate.substring(5,7)-1 ,endDate.substring(8,10));

    days = parseInt((end - start)/1000/60/60/24)+1;
    
    divID = "NewMainVideobox_ver"+type;
    
    
    
    
    var table = "<div style='margin:0px;' class=\"csv-box-header\"><strong>"+title+"</strong><div class=\"mnum\" style=\"color:#444\"><span><span style=\"display:none;\"><input onclick=\"getCSVData_save('" +divID+ "X');\" type=\"button\"  id=\"createcsv\" value=\"生成csv\" /></span><a href=\"javascript:getCSVData('" +divID+ "X');\" >下载</a></span><a href=\"javascript:getCSVData('" +divID+ "X');\"><img src=\"resources/images/csv.png\" style=\"vertical-align: middle;\" \></a></div></div>";
    
    table += "<div style=\"overflow:auto;height:150px;\" class='bgbg'>";
    
    table += "<table class='new_silver_table' id='" + divID + "X'><thead><tr><th style='cursor: pointer;' class='new_silver_first_n desc_table' id='"+divID+"th1' onclick=\" tableSorting('"+divID+"', 1); \" >日期</th><th>"+ tname +"</th>";
    
    table += "</tr>";

	table += "<tr><th class=\"new_silver_first_n footer\"></th>"
    
    table += "<th class='footer' style='padding:0px;'>";
    
    for(j=0; j<_vers.length; j++) {
            vertou = _vers[j].replace("N/A","早期版本").replace("v","").replace("V","");
            table += "<div style='float:left;border-right:1px solid #D8D7D7;width:auto;'><div style='width:auto;border-bottom:1px solid #D8D7D7;padding:3px;'>"+vertou+"<span style='display:none'>  |  </span></div><div style='width:auto;padding:0px;' >  <div  class='verdivri' style='pading-top:3px;'>平均时长(s)</div> <div class='verdivri'>t <= 3s <br />优秀</div>  <div class='verdivri'> 3< t <= 5s <br />良好</div>  <div class='verdivri'>5 < t <=8s <br />达标</div>  <div class='verdivri'> 8 < t <= 300s <br />超时</div>  <div class='verdivri'> 300s < t <br />异常 </div></div></div>";
            table += "</div>";
        
    }
    table += "</th>";
    table += "</tr></thead><tbody>";
    
    var _url = "/client/"+ type +"?staDate="+startDate+"&pd="+days+"&os="+osID+"&dt="+typeID+"&pm="+marketID+"&vers="+_itemsver+"&tname="+tname;
    
    
    art.dialog.open(_url,{title:title,width:930,padding:0});
    
    //width:'900px',height:'100px'
    //var dialog = art.dialog({title:title,width:'1000px',height:'100px',padding:0});
/*
$.ajax({
    url: "/client/"+ type +"?staDate="+startDate+"&pd="+days+"&os="+osID+"&dt="+typeID+"&pm="+marketID+"&vers="+_itemsver,
    type: "GET",
    async:true,
    dataType:"json",
    success: function (data) {
        
        //table += data['All']['table'];
        table += "</div>";
        
        art.dialog.open('/static/ykAnalytics2/index.html',{title:'人人网', width: 320, height: 300});
        
        //$("#NewMainVideoTable").html(table);
        //dialog.content(table);
        //dialog.load('/static/ykAnalytics2/index.html');
    },
    cache: false
});
*/

}

function mainfreeboxlocalvv(osID,typeID,marketID,title,s_type){
    
    
    if(s_type == "NewMainVideo"){
    
     var jiekou = "2";
    
    }else{
        
        var jiekou = "4";
    
    }
    
    
    var startDate = $("#"+s_type+"StartDate").val();
	var endDate = $("#"+s_type+"EndDate").val();
    
    
    var start = new Date();
    var end = new Date();
    
    
    start.setFullYear(startDate.substring(0,4), startDate.substring(5,7)-1, startDate.substring(8,10));
    end.setFullYear(endDate.substring(0,4), endDate.substring(5,7)-1 ,endDate.substring(8,10));

    days = parseInt((end - start)/1000/60/60/24)+1;
    
    divID = s_type+"boxlocalvv"+osID.replace(/,/g,"")+""+typeID.replace(/,/g,"")+""+marketID.replace(/,/g,"");
    
    
    var table = "<div><div style='margin:0px;' class=\"csv-box-header\"><strong>"+title+"</strong><div class=\"mnum\" style=\"color:#444\"><span><span style=\"display:none;\"><input onclick=\"getCSVData_save('" +divID+ "X');\" type=\"button\"  id=\"createcsv\" value=\"生成csv\" /></span><a href=\"javascript:getCSVData('" +divID+ "X');\" >下载</a></span><a href=\"javascript:getCSVData('" +divID+ "X');\"><img src=\"resources/images/csv.png\" style=\"vertical-align: middle;\" \></a></div></div>";
    
    
    table += "<div style=\" overflow:auto;height:250px;width:1100px;\" class='bgbg'>";
    
    table += "<table class='new_silver_table' id='" + divID + "X'><thead>";
    
    //第一行
    table += "<tr><th style='border-bottom:1px solid #EFEFEF;'></th><th style='border-bottom:1px solid #EFEFEF;' ></th><th></th><th style='border-left:1px solid #EFEFEF;'>本地播放</th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th> <th ></th> <th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'>联网播放</th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th> <th></th></tr>";
    
    //第二行
    table += "<tr><th style='cursor: pointer;border-bottom:1px solid #EFEFEF;' class='new_silver_first_n desc_table' id='"+divID+"th1' onclick=\" tableSorting('"+divID+"', 1); \" >日期</th><th style='border-bottom:1px solid #EFEFEF;'>当日vv</th><th>成功</th><th>失败</th><th>失败</th><th>失败</th><th>失败</th> <th>成功</th> <th></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'>失败</th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th><th style='border-left:1px solid #EFEFEF;'></th> <th>其他</th></tr>";
    
    //第三行
    table += "<tr><th></th><th></th><th>200</th><th>106</th><th>-996</th><th>-997</th><th>-998</th> <th>200</th> <th>-100</th><th>-101</th><th>-102</th><th>-104</th><th>-105</th><th>-106</th><th>-996</th><th>-997</th><th>-998</th><th>-999</th><th>400</th> <th></th></tr>";
    
    
    table += "</thead><tbody>";
    
    
    var dialog = art.dialog({title:title,padding:0,width:1102});
  
$.ajax({
    url: "/client/localvv?staDate="+startDate+"&pd="+days+"&os="+osID+"&dt="+typeID+"&pm="+marketID+"&business_type="+jiekou,
    type: "GET",
    async:true,
    dataType:"json",
    success: function (data) {
        
        table += data['All']['table'];
        table += "</table>";
        table += "</div>";
        dialog.content(table);
    },
    cache: false
});


}

function mainfreeboxduration(osID,typeID,marketID,title,type){
    
    
    if(type == "beforedurationmain"){
      tname = "播放前加载";
    }else{
    
        tname = "播放中加载";
    
    }
    
    var startDate = $("#NewMainVideoStartDate").val();
	var endDate = $("#NewMainVideoEndDate").val();
    
    
    var start = new Date();
    var end = new Date();
    
    
    start.setFullYear(startDate.substring(0,4), startDate.substring(5,7)-1, startDate.substring(8,10));
    end.setFullYear(endDate.substring(0,4), endDate.substring(5,7)-1 ,endDate.substring(8,10));

    days = parseInt((end - start)/1000/60/60/24)+1;
    
    divID = "NewMainVideobox"+type+""+osID.replace(/,/g,"")+""+typeID.replace(/,/g,"")+""+marketID.replace(/,/g,"");;
    
    
    var table = "<div style='margin:0px;' class=\"csv-box-header\"><strong>"+title+"</strong><div class=\"mnum\" style=\"color:#444\"><span><span style=\"display:none;\"><input onclick=\"getCSVData_save('" +divID+ "X');\" type=\"button\"  id=\"createcsv\" value=\"生成csv\" /></span><a href=\"javascript:getCSVData('" +divID+ "X');\" >下载</a></span><a href=\"javascript:getCSVData('" +divID+ "X');\"><img src=\"resources/images/csv.png\" style=\"vertical-align: middle;\" \></a></div></div>";
    
    
    table += "<div style=\" overflow:auto;height:250px;width:925px;\" class='bgbg'>";
    
    table += "<table class='new_silver_table' id='" + divID + "X'><thead><tr><th style='cursor: pointer;' class='new_silver_first_n desc_table' id='"+divID+"th1' onclick=\" tableSorting('"+divID+"', 1); \" >日期</th>";
    
    table += "<th style='cursor: pointer;padding:0px;' id='"+divID+"th"+ (i+2) +"' >" + "<div style='width:auto;border-bottom:1px solid #D8D7D7;padding:3px;text-align:center;'>" + tname + "</div><div style='width:auto;padding:0px;' >  <div  class='verdivri' style='pading-top:3px;'>平均时长(s)</div> <div class='verdivri'>t <= 3s <br />优秀</div>  <div class='verdivri'> 3< t <= 5s <br />良好</div>  <div class='verdivri'>5 < t <=8s <br />达标</div>  <div class='verdivri'> 8 < t <= 300s <br />超时</div>  <div class='verdivri'> 300s < t <br />异常 </div>   </div>" + "</th>";
    
    
    table += "</tr></thead><tbody>";
    
    
    var dialog = art.dialog({title:title,width:927,padding:0});
  
$.ajax({
    url: "/client/"+ type +"?staDate="+startDate+"&pd="+days+"&os="+osID+"&dt="+typeID+"&pm="+marketID,
    type: "GET",
    async:true,
    dataType:"json",
    success: function (data) {
        
        table += data['All']['table'];
        table += "</table>";
        table += "</div>";
        dialog.content(table);
    },
    cache: false
});


}

function zhuanyiyi(pt,shu){
    
    var fanhui = "";
    if(pt=="os"){
        
        if(shu == "All"){
            
            fanhui = "61,52,59";
        
        }else if(shu == "Android"){
        
            fanhui = "61";
        }else if(shu == "iOS"){
        
            fanhui = "52";
        }else if(shu == "WP7"){
        
            fanhui = "59";
        }
    
    }else if(pt=="dt"){
        
        if(shu == "All"){
            
            fanhui = "1,2";
        
        }else if(shu == "Phone"){
        
            fanhui = "1";
        }else if(shu == "Pad"){
        
            fanhui = "2";
        }
    
    }else if(pt=="pm"){
        
        if(shu == "All"){
            
            fanhui = "1,2,3,8";
        
        }else if(shu == "qudao"){
        
            fanhui = "2,8";
        }else if(shu == "changshang"){
        
            fanhui = "1";
        }
    
    }
    
    return fanhui;


}
